package com.hulk.ratel.manage.org;


import com.hulk.ratel.common.constant.enums.BussErrCode;
import com.hulk.ratel.common.exception.ManageRteException;
import com.hulk.ratel.manage.commoncache.TxnCodeOrgClazzCahce;
import com.hulk.ratel.persistence.entity.TxncodeOrgClazz;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Optional;

/**
 * Created by hulk on 2017/10/30.
 * parent
 */
public class BaseManager {

    @Autowired
    protected TxnCodeOrgClazzCahce txnCodePayOrgClazzCahce;

    protected TxncodeOrgClazz getPayorgClazz(String orgCode, String txnCode, String workId) {
        TxncodeOrgClazz orgClazz = Optional.ofNullable(txnCodePayOrgClazzCahce.findTxnCodePayOrgClazz(workId, orgCode, txnCode)).orElseThrow(() -> new ManageRteException(workId, BussErrCode.E_200105));
        return orgClazz;

    }
}
